from selenium.webdriver.common.by import By
from time import sleep
from Base.Base import Base

import pytest
class Page(Base):
    # 登录
    login = (By.XPATH,'/html/body/div[1]/div/div[2]/ul/li[1]/a')
    # 断言一
    dy1 = (By.CLASS_NAME,'reg-new')
    #输入用户名
    username = (By.NAME,'username')
    # 输入密码
    password = (By.XPATH,'/html/body/div[4]/div/div[1]/div[2]/form/div[2]/span[2]/input')
    # 登录按钮
    login1 = (By.XPATH,'//*[@class="finish-btn"]')
    # 搜索
    sousuo = (By.CLASS_NAME,'search-input')
    # 断言2
    dy2 = (By.CLASS_NAME,'color-black')
    def dy1_loc(self):
        return self.dy(self.dy1)
    def dy2_loc(self):
        return self.dy(self.dy2)
    def login_loc(self):
        self.click(self.login)
    def user_name(self,username):
        self.send_keys(self.username,username)
    def password_loc(self,password):
        self.send_keys(self.password,password)
    def login1_loc(self):
        self.click(self.login1)
    def sousuo_loc(self):
        self.send_keys(self.sousuo,'狗')
    def sousuo_loc1(self):
        self.keys(self.sousuo)


    # def login_yw(self,datas):
    #     self.open_url('http://10.59.9.12:7001/')
    #     self.login_loc()
    #     self.user_name(datas.get('username'))
    #     self.password_loc(datas.get('password'))
    #     sleep(10)
    #     self.login1_loc()
    #     sleep(5)
    #     self.sousuo_loc()
    #     self.sousuo_loc1()